package com.ruoyi.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mapper.ParkingOrderMapper;
import com.ruoyi.domain.ParkingOrder;
import com.ruoyi.service.IParkingOrderService;

/**
 * 停车订单Service业务层处理
 * 
 * @author dongdong
 * @date 2025-08-20
 */
@Service
public class ParkingOrderServiceImpl implements IParkingOrderService 
{
    @Autowired
    private ParkingOrderMapper parkingOrderMapper;

    /**
     * 查询停车订单
     * 
     * @param id 停车订单主键
     * @return 停车订单
     */
    @Override
    public ParkingOrder selectParkingOrderById(Long id)
    {
        return parkingOrderMapper.selectParkingOrderById(id);
    }

    /**
     * 查询停车订单列表
     * 
     * @param parkingOrder 停车订单
     * @return 停车订单
     */
    @Override
    @DataScope(deptAlias = "po")
    public List<ParkingOrder> selectParkingOrderList(ParkingOrder parkingOrder)
    {
        return parkingOrderMapper.selectParkingOrderList(parkingOrder);
    }

    /**
     * 新增停车订单
     * 
     * @param parkingOrder 停车订单
     * @return 结果
     */
    @Override
    public int insertParkingOrder(ParkingOrder parkingOrder)
    {
        parkingOrder.setCreateTime(DateUtils.getNowDate());
        return parkingOrderMapper.insertParkingOrder(parkingOrder);
    }

    /**
     * 修改停车订单
     * 
     * @param parkingOrder 停车订单
     * @return 结果
     */
    @Override
    public int updateParkingOrder(ParkingOrder parkingOrder)
    {
        parkingOrder.setUpdateTime(DateUtils.getNowDate());
        return parkingOrderMapper.updateParkingOrder(parkingOrder);
    }

    /**
     * 批量删除停车订单
     * 
     * @param ids 需要删除的停车订单主键
     * @return 结果
     */
    @Override
    public int deleteParkingOrderByIds(Long[] ids)
    {
        return parkingOrderMapper.deleteParkingOrderByIds(ids);
    }

    /**
     * 删除停车订单信息
     * 
     * @param id 停车订单主键
     * @return 结果
     */
    @Override
    public int deleteParkingOrderById(Long id)
    {
        return parkingOrderMapper.deleteParkingOrderById(id);
    }
}
